home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 5_9.lha / 5_9 / 5_9b5.c < prev    next >
Text File  |  1993-08-08  |  548b  |  30 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / Rewrite of Section 5.2.5
  6. oid f()
  7.  
  8.    // char_stack s1(100);
  9.    char_stack s1;
  10.    set_cs(s1, 100);
  11.  
  12.    // char_stack s2(200);
  13.    char_stack s2;
  14.    set_cs(s2, 200);
  15.  
  16.    // s1.push('a');
  17.    push_cs(s1, 'a');
  18.  
  19.    // s2.push(s1.pop());
  20.    push_cs(s2, pop_cs(s1));
  21.  
  22.    // char ch = s2.pop();
  23.    char ch = pop_cs(s2);
  24.    cout << chr(ch) << "\n";
  25.  
  26.    // implicit destructor
  27.    delete_cs(s1);
  28.    delete_cs(s2);
  29.  
  30.